home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Estrategia / tactics_core.swf / scripts / DefineButton2_701 / BUTTONCONDACTION on(rollOver).as < prev   
Encoding:
Text File  |  2007-03-20  |  3.6 KB  |  133 lines

  1. on(rollOver){
  2.    var tunit = _parent._parent._parent.map[row][col];
  3.    if(tunit.unitcell != null)
  4.    {
  5.       var s = new Sound(this);
  6.       s.attachSound("Beep1");
  7.       s.start();
  8.       _parent._parent._parent.pointer._x = _X;
  9.       _parent._parent._parent.pointer._y = _Y;
  10.       _parent._parent._parent.pointer.play();
  11.       _parent._parent._parent.pointer._visible = true;
  12.       var aunit = _parent._parent._parent.currentunit;
  13.       var mindmg;
  14.       var maxdmg;
  15.       if(aunit.damage == "heal")
  16.       {
  17.          mindmg = aunit.ap * 50;
  18.          maxdmg = mindmg + mindmg * aunit.ap / 300;
  19.       }
  20.       else
  21.       {
  22.          var tdf;
  23.          if(aunit.damage == "magic")
  24.          {
  25.             tdf = tunit.mdf;
  26.          }
  27.          else
  28.          {
  29.             tdf = tunit.df;
  30.          }
  31.          maxdmg = mindmg = (aunit.ap - tdf) * 50;
  32.          if(aunit.damage == "magic")
  33.          {
  34.             maxdmg += maxdmg * aunit.ap / 300;
  35.             mindmg -= mindmg * tdf / 200;
  36.          }
  37.          else
  38.          {
  39.             maxdmg += maxdmg * aunit.ag / 100;
  40.             mindmg -= mindmg * tunit.ag / 50;
  41.          }
  42.       }
  43.       if(mindmg < 0)
  44.       {
  45.          mindmg = 0;
  46.       }
  47.       else if(mindmg > 9999)
  48.       {
  49.          mindmg = 9999;
  50.       }
  51.       if(maxdmg < 0)
  52.       {
  53.          maxdmg = 0;
  54.       }
  55.       else if(maxdmg > 9999)
  56.       {
  57.          maxdmg = 9999;
  58.       }
  59.       var vary;
  60.       if(maxdmg != 0)
  61.       {
  62.          vary = Math.round(100 * mindmg / maxdmg);
  63.       }
  64.       else
  65.       {
  66.          vary = 0;
  67.       }
  68.       _parent._parent._parent.targetstats.showstats(tunit,Math.round(maxdmg),vary,aunit.damage == "heal");
  69.    }
  70.    _parent.attachMovie("Blank","bounds",10000);
  71.    _parent.bounds._x = _parent.bounds._y = 0;
  72.    if(_parent.attacktype == "normal")
  73.    {
  74.       var temprow = 0;
  75.       while(temprow < len)
  76.       {
  77.          var tempcol = 0;
  78.          while(tempcol < len)
  79.          {
  80.             if(bbuffer[temprow][tempcol])
  81.             {
  82.                var maprow = temprow + row - _parent.spread;
  83.                var mapcol = tempcol + col - _parent.spread;
  84.                if(bbuffer[temprow][tempcol] != null)
  85.                {
  86.                   var tempcell = "bound" + maprow + "x" + mapcol;
  87.                   _parent.bounds.attachMovie("AttackBound",tempcell,100 * maprow + mapcol);
  88.                   eval("_parent.bounds." + tempcell).row = maprow;
  89.                   eval("_parent.bounds." + tempcell).col = mapcol;
  90.                   eval("_parent.bounds." + tempcell).bounds = bbuffer[temprow][tempcol];
  91.                }
  92.             }
  93.             tempcol++;
  94.          }
  95.          temprow++;
  96.       }
  97.    }
  98.    else if(_parent.attacktype == "line" || _parent.attacktype == "projectile")
  99.    {
  100.       temprow = _parent.crow;
  101.       tempcol = _parent.ccol;
  102.       var i = 0;
  103.       while(i < _parent.range)
  104.       {
  105.          if(col > _parent.ccol)
  106.          {
  107.             tempcol++;
  108.          }
  109.          else if(row > _parent.crow)
  110.          {
  111.             temprow++;
  112.          }
  113.          else if(col < _parent.ccol)
  114.          {
  115.             tempcol--;
  116.          }
  117.          else if(row < _parent.crow)
  118.          {
  119.             temprow--;
  120.          }
  121.          if(bbuffer[i] != null)
  122.          {
  123.             var tempcell = "bound" + temprow + "x" + tempcol;
  124.             _parent.bounds.attachMovie("AttackBound",tempcell,100 * temprow + tempcol);
  125.             eval("_parent.bounds." + tempcell).row = temprow;
  126.             eval("_parent.bounds." + tempcell).col = tempcol;
  127.             eval("_parent.bounds." + tempcell).bounds = bbuffer[i];
  128.          }
  129.          i++;
  130.       }
  131.    }
  132. }
  133.